

var router = require("express").Router();

var Student = require("../modules/db/student");




router.get('/regshow', (req, res)=>{
    // console.log(req.query);
    Student
    .findOne(req.query)
    .exec((err, data)=>{
        res.json({
            error: 0,
            user: data,
          });
  });
})



router.get('/edit', (req, res)=>{

console.log(req.query);

    Student.updateOne(req.query._id, {
        age: req.query.age,
        sex: req.query.sex,
        phone: req.query.phone,
        email: req.query.email,
        introduce: req.query.introduce,

    }, err=>{
        if (err) {
            res.json({
                error: 0,
              });
            
        } else {
            console.log('失败');
        }
    });
  });







module.exports = router;